<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子23-JS进阶（二）</title>
    </head>

    <body>
        <pre>
            <code>
                    // 例子23

                    var person = {};
                    person.name = "TOM";
                    person.getName = function() {
                        return this.name;
                    }
            </code>
        </pre>
        <pre>
            <code>
                    // 直接在定义时，添加属性和方法
                    var person = {
                        name: "TOM",
                        getName: function() {
                            return this.name;
                        }
                    }
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/23.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>